package com.wsllx.service;

import com.wsllx.spring.*;

/**
 * @Classname UserService
 * @Description TODO
 * @Date 2022/4/5 21:11
 * @Created by xinzong
 */
@Component
@Scope("property")
public class UserService implements BeanNameAware, InitializingBean {

    @Autowired
    private OrderService orderService;

    private String beanName;

    public void test() {
        System.out.println(orderService);
    }

    // 实现BeanNameAware接口
    @Override
    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }

    public String getBeanName() {
        return this.beanName;
    }

    @Override
    public void afterPropertiesSet() {
        System.out.println("初始化······afterPropertiesSet");
    }

    @Override
    public String toString() {
        return "UserService{" + "orderService=" + orderService + ", beanName='" + beanName + '\'' + '}';
    }
}
